package com.scedu.spring5.service;


import com.scedu.spring5.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


//在注解里面value属性值可以省略不写，
//默认值是类名称，首字母小写
//UserService=>userService
//@Component(value = "userService") //等价于 <bean id="userService" class="">
@Service()
public class UserService {
    @Value(value = "abc")
    private String name;
   //@Resource //根据类型进行注入
   @Resource(name = "myUserDaoImpl") //根据明成祖注入 这个注解是javax包里面的
   private UserDao userDao; //在service类里添加dao类型属性
    public void add(){
        System.out.println(" -----service add -------"+name);
        userDao.add();
    }
}
